﻿@model OnlineEducation.Data.Entities.TeachingPlan
@{
    Layout = null;
}
<!-- Start Content-->
@*<div class="container-fluid">*@
<div class="modal-header">
    <h4 class="modal-title">添加临时教学计划</h4>
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>

<form onsubmit="return SubmitForm(this,'/TeachingPlan/SaveAdhoc')">
    <div class="modal-body p-4">
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <div class="row">
            <input type="hidden" asp-for="TeacherId" />
            <div class="col-md-12">
                <div class="form-group">
                    <label asp-for="Name" class="control-label"></label>
                    <input asp-for="Name" class="form-control" placeholder="请输入名称" onkeyup="this.value=this.value.replace(/^\s+|\s+$/g,'')" />

                </div>
            </div>
            
            <div class="col-md-12">
                <div class="form-group">
                    <label asp-for="BeginTime" class="control-label"></label>
                    <input type="text" asp-for="BeginTime" class="form-control" placeholder="输入开始时间" />
                    <span asp-validation-for="BeginTime" class="text-danger"></span>
                </div>
            </div>
            <div class="col-md-12">
                <div class="form-group">
                    <label asp-for="MaterialURLs" class="control-label"></label>
                    <input asp-for="MaterialURLs" type="file" class="dropify" id="MaterialURLs" data-height="100" data-max-file-size-preview="30M" />
                    <span asp-validation-for="MaterialURLs" class="text-danger"></span>
                </div>
            </div>
            <div class="col-md-12">
                <div class="form-group">
                    <label class="control-label">选择学生</label>
                    <select class="form-control select2-multiple" data-toggle="select2" name="students" multiple="multiple" data-placeholder="Choose ...">
                        @foreach (var student in @ViewBag.Student)
                        {
                            <option value="@(student.GetType().GetProperty("Id").GetValue(student,null))">@(student.GetType().GetProperty("UserName").GetValue(student,null))</option>
                        }
                    </select>

                </div>
            </div>


            <div class="modal-footer">
                <button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal">关闭</button>
                <button type="submit" class="btn btn-primary waves-effect waves-light">保存</button>
            </div>

        </div>
    </div>
</form>



<!-- end row -->



<script>

        Ladda.bind('.btn-primary', { timeout: 1000 });

        $(function () {

            $('[data-toggle="select2"]').select2({ width: '100%', allowClear: true, selectOnClose: false});

            $("#MaterialURLs").dropify({
                messages: {
                    default: "拖放一个文件到这里或者点击添加一个文件",
                    replace: "拖放或者点击替换一个文件",
                    remove: "删除",
                    error: "Ooops, 出错了."
                },
                error: {
                    fileSize: "文件尺寸太大 (最大30M).",
                    imageFormat: '只允许({{ value }})文件格式.'
                }
            });

            $("#BeginTime").flatpickr({
                mode: "single",
                enableTime: true,
                dateFormat: "Y-m-d H:i",
                locale: "zh",
            });

        });
</script>

